package com.hdu.dwh.service.impl.cube_impl;

import java.util.Set;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdu.dwh.mapper.cube_mapper.CuboidDimensionMapper;
import com.hdu.dwh.pojos.cube_pojos.CuboidDimension;
import com.hdu.dwh.service.cube_service.CuboidDimensionService;

@Service
public class CuboidDimensionServiceImpl extends ServiceImpl<CuboidDimensionMapper, CuboidDimension> implements CuboidDimensionService {

    @Override
    public Set<CuboidDimension> getCuboidDimensionsByCuboidId(Integer id) {
        Set<CuboidDimension> dimensions = this.lambdaQuery()
            .eq(CuboidDimension::getCuboidId, id)
            .list()
            .stream()
            .collect(java.util.stream.Collectors.toSet());
        return dimensions;
    }

    @Override
    public void removeByCuboidId(Integer id) {
        this.lambdaUpdate()
            .eq(CuboidDimension::getCuboidId, id)
            .remove();
    }
    
}
